package com.nd.android.musicboxlibrary.business.db.parsers;

import android.content.ContentValues;
import android.database.Cursor;
import com.nd.android.musicboxlibrary.business.bean.Album;
import com.nd.android.musicboxlibrary.business.db.table.AlbumColumns;

/**
 * 认证信息DB解析类
 * 
 * @author 慕容秋 (muroqiu@qq.com)
 */
public class AlbumDbParser implements DbParser<Album> {

    @Override
    public Album parse(Cursor dbCursor) {
        Album obj = new Album();
        obj.setId(dbCursor.getLong(dbCursor.getColumnIndex(AlbumColumns.FID)));
        obj.setName(dbCursor.getString(dbCursor.getColumnIndex(AlbumColumns.NAME)));
        obj.setDesc(dbCursor.getString(dbCursor.getColumnIndex(AlbumColumns.DESC)));
        obj.setBgFid(dbCursor.getLong(dbCursor.getColumnIndex(AlbumColumns.BGFID)));

        return obj;
    }

    @Override
    public ContentValues toContentValues(Album t) {
        ContentValues values = new ContentValues();
        values.put(AlbumColumns.FID, t.getId());
        values.put(AlbumColumns.NAME, t.getName());
        values.put(AlbumColumns.DESC, t.getDesc());
        values.put(AlbumColumns.BGFID, t.getBgFid());

        return values;
    }
}
